﻿using System;
using ASPNETVN.PORTAL.Components.Share;
using ASPNETVN.PORTAL.Components.UI;
using QLC.Modules.TDHS.Components;

namespace QLC.Modules.TDHS.Controls
{
    public partial class ViewItem : ItemControl
    {
        protected override void OnInit(EventArgs e)
        {
            this.ButtonCancel = LinkButtonCancel;

            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                Category.BuildDropDownListControl(ref DropDownListCategory, this.ModuleID);
                if (this.ItemID > 0)
                {
                    Item item = Item.Load(this.ItemID);
                    if (item != null)
                    {
                        DropDownListCategory.SelectedValue = item.CategoryID.ToString();
                        TextBoxRegisterNumber.Text = item.RegisterNumber;
                        DropDownListStatus.SelectedValue = item.Status;
                        TextBoxRegisterName.Text = item.RegisterName;
                        TextBoxIdentityNumber.Text = item.IdentityNumber;
                        TextBoxEmail.Text = item.Email;
                        TextBoxPhone.Text = item.Phone;
                        TextBoxAddress.Text = item.Address;
                        TextBoxReply.Text = item.Reply;
                        TextBoxRegisterDate.Text = item.ReceivedDate.ToShortDateString();
                        TextBoxFinishedDate.Text = item.FinishedDate.ToShortDateString();
                    }
                }
            }
        }
    }
}